<script setup lang="ts">
import { useRouter } from 'vue-router';

import { ElButton, ElCard } from 'element-plus';

import { $t } from '#/locales';
import { usePublicStore } from '#/store';

const router = useRouter();

const publicStore = usePublicStore();
const btnClick = (param: string, index: string) => {
  publicStore.updateActiveIndex(index);
  router.push(param);
};
</script>

<template>
  <div class="overviewAll">
    <div class="cardCon">
      <ElCard class="box-card" :body-style="{ padding: '0px' }">
        <div class="pic-box"></div>
        <div
          class="card-header"
          style="align-items: center; text-align: center"
        >
          <span class="card-name">{{
            $t('page.overview.resourceCenter')
          }}</span>
          <div style="padding: 10px; text-align: center">
            <span class="intro-text">{{
              $t('page.overview.resourceCenterIntro')
            }}</span>
          </div>
          <ElButton
            class="btn"
            size="large"
            type="primary"
            @click="btnClick('/resources', '2')"
            round
          >
            {{ $t('page.overview.enter') }}<span class="button-border"></span>
          </ElButton>
        </div>
      </ElCard>

      <ElCard class="box-card" :body-style="{ padding: '0px' }">
        <div class="pic-box"></div>
        <div
          class="card-header"
          style="align-items: center; text-align: center"
        >
          <span class="card-name">{{ $t('page.overview.sceneCenter') }}</span>
          <div style="padding: 10px; text-align: center">
            <span class="intro-text">{{
              $t('page.overview.sceneCenterIntro')
            }}</span>
          </div>
          <ElButton
            class="btn"
            size="large"
            type="primary"
            @click="btnClick('/scene', '3')"
            round
          >
            {{ $t('page.overview.enter') }}<span class="button-border"></span>
          </ElButton>
        </div>
      </ElCard>

      <div class="intro">
        <div class="section-banner">
          <h1
            style="
              display: flex;
              align-items: center;
              justify-content: center;
              height: 85%;
              font-family: '黑体';
              font-size: xx-large;
              color: aliceblue;
              text-align: center;
            "
          >
            {{ $t('page.overview.title') }}
          </h1>
        </div>
      </div>
    </div>
  </div>
</template>

<style lang="scss" scoped>
.overviewAll {
  display: flex;
  flex-direction: column;
  justify-content: space-evenly;
  width: 100%;
  height: 100%;
  background-image: url('@/assets/images/globe.jpg');
  background-repeat: no-repeat;
  background-size: cover;
}

.cardCon {
  display: flex;
  justify-content: space-evenly;
}

.box-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 28%;
  height: 70vh;
  text-align: center;
  background-color: #ffffff5a;
  border-radius: 1em;
}

.card-header {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  justify-content: center;
  height: 30vh;
}

.card-name {
  display: flex;
  align-items: center;
  padding-top: 1.2em;
  font-family: '黑体';
  font-size: 2em;
  font-weight: bold;
  text-align: center;
  background: linear-gradient(to right, #4fa2ec, #6ef8ef);
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.desc-text {
  width: 100%;
  height: 63vh;
  padding-top: 10vh;
  font-size: 2em;
  font-weight: bold;
  text-align: center;
  background: linear-gradient(to right, #4fa2ec, #6ef8ef);
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.desc-text2 {
  width: 100%;
  padding-top: 10vh;
  font-size: 2em;
  font-weight: bold;
  color: #fff;
  text-align: center;
}

.desc-text1 {
  width: 100%;
  font-size: 1.5em;
  font-weight: bold;
  background-image: linear-gradient(to left, #719ea9, #0d6fdf);
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.intro-text {
  display: flex;
  align-items: center;
  padding: 1.875em;
  padding-top: 2em;
  font-size: 1em;
  color: white;
  text-align: center;
}

.btn {
  display: flex;
  gap: 0.625em;
  align-items: center;
  justify-content: center;
  width: 15em;
  padding: 1em 1.5em 1em 1.75em;
  font-family: inherit;
  font-size: 0.8125em;
  font-weight: 500;
  color: #7e95b8;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background-color: #e0e8ef;
  border-color: rgb(255 255 255 / 33.3%);
  border-style: solid;
  border-width: 0.125em;
  border-radius: 2.5em;
  box-shadow:
    -0.25em -0.125em 1em 0 #fff,
    0.25em 0.125em 1em 0 rgb(95 157 231 / 48%);
  transition: 0.2s;
  transform: translate(0, 0) rotate(0deg);
}

.btn:hover {
  color: #516d91;
  background-color: #e5edf5;
  box-shadow:
    -2px -1px 8px 0 #fff,
    2px 1px 8px 0 rgb(95 157 231 / 48%);
}

.btn:active {
  box-shadow: none;
}

.pic-box {
  display: block;
  width: 90%;
  height: 30vh;
  margin: 0 auto;
  margin-top: 20px;
  background-image: url('@/assets/images/overview.png');
}

@media (max-width: 850px) {
  .overviewAll {
    height: auto;
  }

  .cardCon {
    flex-wrap: wrap;
    justify-content: center;
  }

  .box-card {
    width: 80%;
    margin-bottom: 10px;
  }
}

.intro {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
}

.section-banner {
  bottom: 0;
  width: 30vh;
  height: 30vh;
  background: url('');
  background-position: left;
  background-size: cover;
  border-radius: 50%;
  box-shadow:
    0 0 20px rgb(255 255 255 / 20%),
    -5px 0 8px #c3f4ff inset,
    15px 2px 25px #000 inset,
    -24px -2px 34px #c3f4ff99 inset,
    250px 0 44px #0006 inset,
    150px 0 38px #000a inset;

  /* position: relative; */
  transition: left 0.3s linear;
  animation: earth-rotate 30s linear 0s infinite;
}

@keyframes earth-rotate {
  0% {
    background-position: 0 0;
  }

  100% {
    background-position: 400px 0;
  }
}

.curved-corner-star {
  position: relative;
  display: flex;
}

#curved-corner-bottomleft,
#curved-corner-bottomright,
#curved-corner-topleft,
#curved-corner-topright {
  position: relative;
  width: 4px;
  height: 5px;
  overflow: hidden;
}

#curved-corner-bottomleft::before,
#curved-corner-bottomright::before,
#curved-corner-topleft::before,
#curved-corner-topright::before {
  position: absolute;
  display: block;
  width: 200%;
  height: 200%;
  content: '';
  border-radius: 50%;
}

#curved-corner-bottomleft::before {
  bottom: 0;
  left: 0;
  box-shadow: -5px 5px 0 0 white;
}

#curved-corner-bottomright::before {
  right: 0;
  bottom: 0;
  box-shadow: 5px 5px 0 0 white;
}

#curved-corner-topleft::before {
  top: 0;
  left: 0;
  box-shadow: -5px -5px 0 0 white;
}

#curved-corner-topright::before {
  top: 0;
  right: 0;
  box-shadow: 5px -5px 0 0 white;
}

@keyframes twinkling {
  0%,
  100% {
    opacity: 0.1;
  }

  50% {
    opacity: 1;
  }
}

#star-1 {
  position: absolute;
  left: -20px;
  animation: twinkling 3s infinite;
}

#star-2 {
  position: absolute;
  top: 30px;
  left: -40px;
  animation: twinkling 2s infinite;
}

#star-3 {
  position: absolute;
  top: 90px;
  left: 350px;
  animation: twinkling 4s infinite;
}

#star-4 {
  position: absolute;
  top: 290px;
  left: 200px;
  animation: twinkling 3s infinite;
}

#star-5 {
  position: absolute;
  top: 270px;
  left: 50px;
  animation: twinkling 1.5s infinite;
}

#star-6 {
  position: absolute;
  top: -50px;
  left: 250px;
  animation: twinkling 4s infinite;
}

#star-7 {
  position: absolute;
  top: 60px;
  left: 290px;
  animation: twinkling 2s infinite;
}
</style>
